"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
process.title = 'WebRTC Signaling Server';
const express_1 = __importDefault(require("express"));
const socket_io_1 = require("socket.io");
const socket_1 = __importDefault(require("./socket"));
const httpServer_1 = __importDefault(require("./httpServer"));
const helmet = require('helmet');
const cors = require('cors');
const bodyParser = require('body-parser');
const compression = require('compression');
const morgan = require('morgan');
const app = (0, express_1.default)();
app.use(compression());
app.use(morgan('dev'));
app.use(helmet.hsts());
app.use(bodyParser.json({ limit: '25mb' }));
app.use(bodyParser.urlencoded({ extended: true, limit: '25mb' }));
app.use(cors());
app.locals.members = {};
app.locals.rooms = {};
app.locals.sockets = {};
async function run() {
    const serverOption = {
        transports: ['websocket'],
        allowUpgrades: false,
    };
    let httpsServer = await (0, httpServer_1.default)(app);
    app.locals.io = new socket_io_1.Server(httpsServer, serverOption);
    app.locals.io.path('/intercom/');
    await (0, socket_1.default)(app);
    console.log('socket.io');
}
run();
